package Q5;

import java.io.Serializable;

public class Message implements Serializable {
    private static final long serialVersionUID = -4835022219198655L;
    private String messageType;
    private String user;
    private String data;// 文件名 或 字符串类
    private byte[] fileData;
    private int res = 0;

    public Message(String messageType, String user, String data) {
        this.messageType = messageType;
        this.user = user;
        this.data = data;// chat内容或
    }

    public Message(String messageType, String user, String data, byte[] fileData, int res) {
        this.messageType = messageType;
        this.user = user;
        this.data = data; //文件名
        this.fileData = fileData;//文件
        this.res = res;//末尾数值
    }

    public String getMessageType() {
        return messageType;
    }

    public void setMessageType(String messageType) {
        this.messageType = messageType;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public byte[] getFileData() {
        return fileData;
    }

    public void setFileData(byte[] fileData) {
        this.fileData = fileData;
    }

    public int getRes() {
        return res;
    }

    public void setRes(int res) {
        this.res = res;
    }

    @Override
    public String toString() {
        return "Message{" +
                "messageType='" + messageType + '\'' +
                ", user='" + user + '\'' +
                ", data='" + data + '\'' +
                '}';
    }
}
